package com.sunwayhorizo.health.hl7.rim;

import java.io.Serializable;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;

import org.jboss.seam.annotations.Name;

import com.sunwayhorizo.health.common.DataTypeUtil;
import com.sunwayhorizo.health.hl7.common.Hl7Exception;
import com.sunwayhorizo.health.hl7.datatypes.BL;
import com.sunwayhorizo.health.hl7.datatypes.CE;
import com.sunwayhorizo.health.hl7.datatypes.CS;
import com.sunwayhorizo.health.hl7.datatypes.INT;
import com.sunwayhorizo.health.hl7.datatypes.PQ;
import com.sunwayhorizo.health.hl7.datatypes.ST;
import com.sunwayhorizo.health.hl7.persistent.RimCoreActRelations;

@Name("ActRelationship")
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@AttributeOverrides({ @AttributeOverride(name = "typeCode", column = @Column(name = "TYPE_CODE")),
        @AttributeOverride(name = "splitCode", column = @Column(name = "SPLIT_CODE")) })
@DiscriminatorValue("ACTRELATIONSHIP")
public class ActRelationship extends RimCoreActRelations implements Serializable
{

    /*
     * public CS CheckpointCode; public CS ConjunctionCode; public BL
     * ContextConductionInd; public CS ContextControlCode; public BL
     * InversionInd; public CS JoinCode; public ST LocalVariableName; public BL
     * NegationInd; public PQ PauseQuantity; public REAL PriorityNumberV2;
     * public BL SeperatableInd; public INT SequenceNumber; public Act Source;
     * public CS SplitCode; public Act Target; public CS TypeCode; public CE
     * UncertaintyCode;
     */

    /**
     * 
     */
    private static final long serialVersionUID = 1L;


    public void setCheckpointCode(CS CheckpointCode)
    {
        this.setCheckpointCode(CheckpointCode.code().toString());
    }


    public CS getCheckpointCode() throws Hl7Exception
    {
        return DataTypeUtil.getCS(this.getCheckpoint_Code());
    }


    public void setConjunctionCode(CS ConjunctionCode)
    {
        this.setConjunctionCode(ConjunctionCode.code().toString());
    }


    public CS getConjunctionCode() throws Hl7Exception
    {
        return DataTypeUtil.getCS(this.getConjunction_Code());
    }


    public void setContextConductionInd(BL ContextConductionInd)
    {
        this.setContextConductionFlag(ContextConductionInd.toString());
    }


    public BL getContextConductionInd() throws Hl7Exception
    {
        return DataTypeUtil.getBL(this.getContextConductionFlag());
    }


    public void setContextControlCode(CS ContextControlCode)
    {
        this.setContextControlCode(ContextControlCode.code().toString());
    }


    public CS getContextControlCode() throws Hl7Exception
    {
        return DataTypeUtil.getCS(this.getContextControl_Code());
    }


    public void setInversionInd(BL InversionInd)
    {
        this.setInversionFlag(InversionInd.toString());
    }


    public BL getInversionInd() throws Hl7Exception
    {
        return DataTypeUtil.getBL(this.getInversionFlag());
    }


    public void setJoinCode(CS JoinCode)
    {
        this.setJoinCode(JoinCode.code().toString());
    }


    public CS getJoinCode() throws Hl7Exception
    {
        return DataTypeUtil.getCS(this.getJoin_Code());
    }


    public void setLocalVariableName(ST LocalVariableName)
    {
        this.setLocalVariableName(LocalVariableName.toString());
    }


    public ST getLocalVariableName() throws Hl7Exception
    {
        return DataTypeUtil.getST(this.getLocalVariable_Name());
    }


    public void setNegationInd(BL NegationInd)
    {
        this.setNegationFlag(NegationInd.toString());
    }


    public BL getNegationInd() throws Hl7Exception
    {
        return DataTypeUtil.getBL(this.getNegationFlag());
    }


    public void setPauseQuantity(PQ PauseQuantity)
    {
        this.setPauseQtyTxt(PauseQuantity.value().toString());
        this.setPauseQtyTxt(PauseQuantity.unit().toString());
    }


    public PQ getPauseQuantity() throws Hl7Exception
    {
        return DataTypeUtil.getPQ(this.getPauseQtyTxt(), this.getPauseQtyUomCode());
    }


    /*
     * public void setPriorityNumberV2(REAL PriorityNumberV2) {
     * this.PriorityNumberV2 = PriorityNumberV2; }
     * 
     * public REAL getPriorityNumberV2() { return PriorityNumberV2; }
     */
    public void setSeperatableInd(BL SeperatableInd)
    {
        this.setSeparableFlag(SeperatableInd.toString());
    }


    public BL getSeperatableInd() throws Hl7Exception
    {
        return DataTypeUtil.getBL(this.getSeparableFlag());
    }


    public void setSequenceNumber(INT SequenceNumber)
    {
        this.setSequenceNum(SequenceNumber.longValue());
    }


    public INT getSequenceNumber() throws Hl7Exception
    {
        return DataTypeUtil.getINT(this.getSequenceNum());
    }


    public void setSplitCode(CS SplitCode)
    {
        if (SplitCode == null)
        {
            super.splitCode = null;
            return;
        }
        this.setSplitCode(SplitCode.code().stringValue());
    }


    public CS getSplitCode() throws Hl7Exception
    {
        return DataTypeUtil.getCS(this.getSplit_Code());
    }


    public void setTypeCode(CS TypeCode)
    {
        super.typeCode = (TypeCode.code().toString());
    }


    public CS getTypeCode() throws Hl7Exception
    {
        return DataTypeUtil.getCS(super.typeCode);
    }


    public void setUncertaintyCode(CE uncertaintyCode)
    {
        this.setUncertaintyCodeEtsId(uncertaintyCode.code().toString());
    }


    public CE getUncertaintyCode() throws Hl7Exception
    {
        return DataTypeUtil.getCE(this.getUncertaintyCodeEtsId(), "NullFlavor.NI");
    }

    @Column(name = "CHECKPOINT_CODE")
    private String checkpointCode;
    @Column(name = "CONJUNCTION_CODE")
    private String conjunctionCode;
    @Column(name = "CONTEXT_CONDUCTION_FLAG")
    private String contextConductionFlag;
    @Column(name = "CONTEXT_CONTROL_CODE")
    private String contextControlCode;
    @Column(name = "INVERSION_FLAG")
    private String inversionFlag;
    @Column(name = "JOIN_CODE")
    private String joinCode;
    @Column(name = "LOCAL_VARIABLE_NAME")
    private String localVariableName;
    @Column(name = "NEGATION_FLAG")
    private String negationFlag;
    @Column(name = "PAUSE_QTY_TXT")
    private String pauseQtyTxt;
    @Column(name = "PAUSE_QTY_UOM_CODE")
    private String pauseQtyUomCode;
    @Column(name = "PRIORITY_NUM")
    private Long priorityNum;
    @Column(name = "UNCERTAINTY_CODE_ETS_ID")
    private String uncertaintyCodeEtsId;
    @Column(name = "SEPARABLE_FLAG")
    private String separableFlag;
    @Column(name = "SEQUENCE_NUM")
    private Long sequenceNum;

    @Column(name = "OWNER_CODE")
    private String ownerCode;


    private String getCheckpoint_Code()
    {
        return checkpointCode;
    }


    private void setCheckpointCode(String checkpointCode)
    {
        this.checkpointCode = checkpointCode;
    }


    private String getConjunction_Code()
    {
        return conjunctionCode;
    }


    private void setConjunctionCode(String conjunctionCode)
    {
        this.conjunctionCode = conjunctionCode;
    }


    private String getContextConductionFlag()
    {
        return contextConductionFlag;
    }


    private void setContextConductionFlag(String contextConductionFlag)
    {
        this.contextConductionFlag = contextConductionFlag;
    }


    private String getContextControl_Code()
    {
        return contextControlCode;
    }


    private void setContextControlCode(String contextControlCode)
    {
        this.contextControlCode = contextControlCode;
    }


    private String getInversionFlag()
    {
        return inversionFlag;
    }


    private void setInversionFlag(String inversionFlag)
    {
        this.inversionFlag = inversionFlag;
    }


    private String getJoin_Code()
    {
        return joinCode;
    }


    private void setJoinCode(String joinCode)
    {
        this.joinCode = joinCode;
    }


    private String getLocalVariable_Name()
    {
        return localVariableName;
    }


    private void setLocalVariableName(String localVariableName)
    {
        this.localVariableName = localVariableName;
    }


    private String getNegationFlag()
    {
        return negationFlag;
    }


    private void setNegationFlag(String negationFlag)
    {
        this.negationFlag = negationFlag;
    }


    private String getPauseQtyTxt()
    {
        return pauseQtyTxt;
    }


    private void setPauseQtyTxt(String pauseQtyTxt)
    {
        this.pauseQtyTxt = pauseQtyTxt;
    }


    private String getPauseQtyUomCode()
    {
        return pauseQtyUomCode;
    }


    private void setPauseQtyUomCode(String pauseQtyUomCode)
    {
        this.pauseQtyUomCode = pauseQtyUomCode;
    }


    private Long getPriorityNum()
    {
        return priorityNum;
    }


    private void setPriorityNum(Long priorityNum)
    {
        this.priorityNum = priorityNum;
    }


    private String getSeparableFlag()
    {
        return separableFlag;
    }


    private void setSeparableFlag(String separableFlag)
    {
        this.separableFlag = separableFlag;
    }


    private Long getSequenceNum()
    {
        return sequenceNum;
    }


    private void setSequenceNum(Long sequenceNum)
    {
        this.sequenceNum = sequenceNum;
    }


    private String getSplit_Code()
    {
        return splitCode;
    }


    private void setSplitCode(String splitCode)
    {
        this.splitCode = splitCode;
    }


    private String getUncertaintyCodeEtsId()
    {
        return uncertaintyCodeEtsId;
    }


    private void setUncertaintyCodeEtsId(String uncertaintyCodeEtsId)
    {
        this.uncertaintyCodeEtsId = uncertaintyCodeEtsId;
    }


    private void setOwnerCode(String ownerCode)
    {
        this.ownerCode = ownerCode;
    }


    private String getOwnerCode()
    {
        return ownerCode;
    }

}
